<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<html>
			<head>
				<meta charset="utf-8">
				<title></title>
			</head>
			<body>
				<h2>在事件中调用函数</h2>
				<button onclick="hello()">调用hello()</button>
				<h2>在链接中调用函数</h2>
				<a href="javascript:hello();">调用hello()</a>
				<h2>带参数的函数</h2>
				<input type="text" id="input1"/>+
				<input type="text" id="input2"/><button onclick="calc()">=</button>
				<input type="text" id="input3"/>
				<script>
					
				
					function hello()
					{
						console.log("Hello world!");
					}
					
					function add(a,b)
					{
						c = a+b;
						return c;
					}
					
					function calc()
					{
						num1 = parseInt(input1.value);
						num2 = parseInt(input2.value);
						input3.value = add(num1,num2);
					}
					
					
					hello();
					
					
					
				</script>
				
			</body>
		</html>
			
			
		</script>
		
	</body>
</html>